package serwertestowy;

import java.io.*;
import java.net.*;
import java.util.*;

class Main
{
      public static void main(String argv[]) throws Exception
      {
          ServerSocket welcomeSocket = new ServerSocket(8888);
          ObjectOutputStream oos;


          while(true)
          {
              Socket connectionSocket = welcomeSocket.accept();
              oos = new ObjectOutputStream(connectionSocket.getOutputStream());
              Random rand = new Random((new Date()).getTime());
              int i = rand.nextInt(100);
              oos.writeObject(i);

              Thread.sleep(1000);
              System.out.println(i);

         }
      }
}